package cn.wolfcode.Controller;

import cn.wolfcode.qo.jsonResult;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


//注意ajax是异步请求，所以不是通过表单form，通过表单form提交的是同步请求
@Controller
public class CheckLoginController {

    //根据用户传入的用户名信息来返回封装好的json结果集对象
    @RequestMapping("/checkLogin")
    @ResponseBody
    public jsonResult checkLogin(String username,String password){
        jsonResult jsonResult = new jsonResult();
        System.out.println(username+password);
        if ("admin".equals(username) && "1".equals(password)){
            jsonResult.setMsg("登录成功");
            jsonResult.setSuccess(true);
        }else {
            jsonResult.setMsg("登录失败");
            jsonResult.setSuccess(false);
        }
        return jsonResult;

    }
}
